<meta charset="UTF-8">
<?php
/**
 * Created by PhpStorm.
 * User: MarcosAlex
 * Date: 26/08/14
 * Time: 09:33
 */
@include("../mysql_connect/conexao.php");

if (isset($_POST['username']) && isset($_POST['password'])){
            $sql = "select usuario,senha from login where usuario = '".$_POST['username']."' and senha= '".$_POST['password']."'";
            $resultado = mysqli_query($conexao, $sql);
            if(mysqli_num_rows($resultado) <= 0){
                echo "<script>alert('Usuário e senha invalidos');</script>";
                echo "<script>document.location = 'view.php';</script>";
            } else{
                echo "<script>document.location = '../menu.php';</script>";
            }

}else {
    echo "<script>document.location = 'login/view.php';</script>";
}
